debug = function(obj)
{
	console.log(obj)
	for(var i in obj)
	{
		console.log(i)
		console.log(obj[i])
	}
	console.log("debug_over")
}

alert_debug = function(obj)
{
	alert(obj)
	for(var i in obj)
	{
		alert(i)
		alert(obj[i])
	}
	alert("debug_over")
}

jsontostring = function(obj) 
{
    var t = typeof (obj);
    if (t != "object" || obj === null) 
    {
        // simple data type
        if (t == "string") obj = '"'+obj+'"';
        return String(obj);
    }
    else 
    {
        // recurse array or object
        var n, v, json = [], arr = (obj && obj.constructor == Array);
        for (n in obj) 
        {
            v = obj[n]; t = typeof(v);
            if (t == "string") v = '"'+v+'"';
            else if (t == "object" && v !== null) v = JSON.stringify(v);
            json.push((arr ? "" : '"' + n + '":') + String(v));
        }
        return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
    }
}

stringtojson = function(str) 
{  
    if (str == "") 
    {
        str = '""';
    }
        
    str = "var p=" + str + ";"
    eval(str);
    return p;
}
